<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>主页面</title>
<style type="text/css">
table.gridtable {
	font-family: verdana, arial, sans-serif;
	font-size: 11px;
	color: #333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
}

table.gridtable th {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #dedede;
}

table.gridtable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #ffffff;
}

tr:hover td {
	background: none;
}

tr:hover {
	background-color: none;
}

thead th {
	position: sticky;
	top: 0;
	z-index: 1;
}

table {
	border-collapse: collapse;
	width: 100%;
}

th, td {
	padding: 8px;
	text-align: left;
}

th {
	background-color: #f2f2f2;
}

#myDiv { 
	background-color: #f1f1f1;
	padding: 10px;
}
  .popup {
      width: 1000px;
      height: 700px;
      background-color: #f1f1f1;
      border: 1px solid #ccc;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
    .close-btn {
      position: absolute;
      top: 0;
      right: 0;
      padding: 10px;
      cursor: pointer;
      font-size: 20px;
      color: #aaa;
    }
</style>
<meta charset="UTF-8">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/grid1.0.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/echarts.min.js"></script>
</head>
</head>
<body>
	天<input id="day" value="20">
	量<input id="chaju1" value="3">
	价<input id="chaju2" value="1.06">
	<button id="bt1">连续20天，量大和小差距3倍，差价在1.25倍,放弃</button>
	<hr>
	天<input id="day1" value="8">
	量<input id="chaju3" value="5"> 
	价<input id="chaju4" value="1.06"> 
	<button id="bt2">连续三天的成交量，大家之前的成交量5倍以上，则价格没有超过5%</button>
		<hr>
	天<input id="day2" value="5">
	量<input id="chaju5" value="5">
	价<input id="chaju6" value="-1">
	价<input id="chaju7" value="3"> 
	<button id="bt3">连续5天价格为大于-1小于2，则量超过5</button>
	<hr>
	天<input id="day3" value="20">
	天<input id="day4" value="5">
	量<input id="liang" value="4">
	价<input id="jia" value="0.9"> 
	<button id="bt4">20天以内有涨停。则成交量最近5天低于3,价格之相当最高的0.9</button> 
	<hr>
	<input type="day5" value="3"><button id="bt5">查询三天全部为正</button>
	
	 
	<hr>
	开<input id="day6" value=""><input id="jia6" >终<input id="day7" value=""><input id="jia7" ><button id="bt6_00">纯粹的1进2</button><button id="bt6_0">纯粹的2进3</button><button id="bt6_01">100-200亿首版</button><button id="bt6">2进3</button>
	<button id="bt6_1">涨停原因分析</button><input id="groupName" style="width: 80px;"><button id="bt6_2">加入main2中分组</button>
	<div id="div2-3"></div>
	<hr>
	算法类<input id="suanfa" value="4"> 日期<input id="date" value="20240801"><button id="bt10">查询</button>
	<input type="text" id="text5" value="" style="width:200px" placeholder="关键字">
	<button id="bt8">保存关键字</button>
	<button id="bt9">恢复</button>
	<button id="bt9_1">查询数据概念匹配的股票</button>
	<hr>
	在<input id="text6" value="">的<<input id="text6_1" value="-8">到<input id="text6_2">的》<input id="text6_3" value="8"><button id="bt12">尾盘买入法</button>
	 
	<hr>
	<button id="bt13_0">加载昨日涨停原因</button>
	<button id="bt13">加载每日涨停原因</button><button id="bt14">加载每日概念数据</button>
	<button id="bt15">加载当日QQ数据</button>
	<hr>
	<select id="s1">
		<option value="1" selected="selected">上午</option>
		<option value="0">下午</option>
	</select>
	前一天<input id="qianyitian" style="width:100px;"> 较昨日放大1倍<input value="1" id="text10">成交量》=<input id="text8" value="8">涨跌幅>=<input id="text9" value="0.5-4"><button id="bt16">查询当日分歧</button>
	备注：查询当前成交量大于昨天全天成交的，则当前只涨了2-4的，则昨天的涨跌幅不大于5。上午没量要超过1或者更大，才好涨了才好，下午则是量没有达到，还是涨了2-4个点，第二天才能期盼
	<hr>
	当日线上市值<input id="text11" style="width:100px;" value="50">到<input id="text12" style="width:100px;" value="400">成交额：<input type="text" id="text13" value="20">亿<button id="bt17">查询</button>
	<hr> 
	当日线上市值<input id="text14" style="width:100px;" value="50">到<input id="text15" style="width:100px;" value="400"><button id="button_16">首板</button>（线上10天内没有涨超9个点的。当日涨超过5个点的，按成交金额排序）
	<hr>
	<button id="button_17">最近5天热股的产生下引线(此算法只在早上9.45效果好)</button>
	<div id="div1"></div>
	<div id="myDiv"></div>
	 <div class="popup" style="display:none;overflow-y:auto; ">
    <!-- 这里可以添加你的内容 --> <span class="close-btn" id="san1">×</span>
       
     
 	 </div>
</body>
<script type="text/javascript">
	(function() {
		$("#bt6_00").click(function(){
			$.ajax({
				type : "get",
				url : "${pageContext.request.contextPath}/jisuan25",
				dataType : 'text',
				data:{day6:$("#day6").val(),day7:$("#day7").val(),jia6:$("#jia6").val(),jia7:$("#jia7").val(),flag:1,type:0},
				success : function(msg) {
					$("#myDiv").html(msg);
					$("#mytalbe").addClass("gridtable"); 
					tongyong();
				}
			}); 
		});
	$("#bt6_0").click(function(){
		$.ajax({
			type : "get",
			url : "${pageContext.request.contextPath}/jisuan25",
			dataType : 'text',
			data:{day6:$("#day6").val(),day7:$("#day7").val(),jia6:$("#jia6").val(),jia7:$("#jia7").val(),flag:1},
			success : function(msg) {
				$("#myDiv").html(msg);
				$("#mytalbe").addClass("gridtable"); 
				tongyong();
			}
		}); 
	});
	
	$("#bt6_01").click(function(){
		$.ajax({
			type : "get",
			url : "${pageContext.request.contextPath}/jisuan25",
			dataType : 'text',
			data:{day6:$("#day6").val(),day7:$("#day7").val(),jia6:$("#jia6").val(),jia7:$("#jia7").val(),flag:0},
			success : function(msg) {
				$("#myDiv").html(msg);
				$("#mytalbe").addClass("gridtable"); 
				tongyong();
			}
		}); 
	});
	
		
	 $("#button_17").click(function(){
		 
			var text17 = $("#text17").val(); 
			 $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/getZuiJinfanla",
					dataType : 'text', 
					data:{text17:$("#text17").val(),text18:$("#text18").val(),text19:$("#text19").val()},
					success : function(msg) { 
						$("#myDiv").html(msg);
						$("#mytalbe").addClass("gridtable"); 
						tongyong();
						 $('table tbody tr').sort(function(a, b) {
						        return parseFloat($('td[name=xiaying]', b).text()) - parseFloat($('td[name=xiaying]', a).text());
						  }).appendTo('table tbody');
						 
					} 
				});  
	});
	  $("#button_16").click(function(){
			 
			var text14 = $("#text14").val();
			var text15 = $("#text15").val();
			 $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/get1jin2",
					dataType : 'text', 
					data:{text14:$("#text14").val(),text15:$("#text15").val()},
					success : function(msg) { 
						$("#myDiv").html(msg);
						$("#mytalbe").addClass("gridtable"); 
						tongyong();
					} 
				});  
		});
		$("#bt17").click(function(){
			
			var text11 = $("#text11").val();
			var text12 = $("#text12").val();
			var text13 = $("#text13").val();
			 $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/getCJ20",
					dataType : 'text', 
					data:{text11:$("#text11").val(),text12:$("#text12").val(),text13:$("#text13").val()},
					success : function(msg) { 
						$("#myDiv").html(msg);
						$("#mytalbe").addClass("gridtable"); 
						tongyong();
					} 
				});  
		});
		
		$("#bt6_2").click(function(){
			
			if($("td[name=code]").length <=0 || $("#groupName").val().length<=0){
				return;
			}
			var arr = [];
			for (var i = 0; i < $("td[name=code]").length; i++) {
				
				var obj = {};
				obj.code = $($("td[name=code]")[i]).attr("code");
				obj.name1 = $($("td[name=name]")[i]).text();
				obj.ztContent = $($("td[name=ztConent]")[i]).attr("ztconent");
				arr.push(obj);
			} 
			 $.ajax({
					type : "post",
					url : "${pageContext.request.contextPath}/add2jin3",
					dataType : 'text', 
					data:{arr:JSON.stringify(arr),groupname:$("#groupName").val()},
				 	success : function(msg) {
						 
						alert(msg);
					} 
				});
			
			
			
		});
		
		
		
		$("#bt16").click(function(){
			var a = $("#text9").val();
			if(a.indexOf("-") <0){
				alert("格式3-4");
				return;
			} 
			 $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/getDRfenqi",
					dataType : 'text', 
					data:{text8:$("#text8").val(),text9:$("#text9").val(),text10:$("#text10").val(),flag:$('#s1').val(),qianyitian:$('#qianyitian').val()},
					success : function(msg) {
						 
						$("#myDiv").html(msg);
						$("#mytalbe").addClass("gridtable"); 
						tongyong();
					} 
				});
			
			
		});
		
		$("#bt6_1").click(function(){
			$("#div2-3").html("");
			var list = $("td[name=ztConent]");
			
			var arrall = [];
		 
			for (var i = 0; i < list.length; i++) { 
				//debugger;
				var text = $(list[i]).text(); 
			     arr1  =text.split("+"); 
			     for(var j=0;j<arr1.length;j++){
			    	 if(arr1[j]==""){
			    		 continue;
			    	 }
			    	 arrall.push($.trim(arr1[j]));
			     }
			}
			// console.log(arrall);
			 var countMap = {};
			 for (var i = 0; i < arrall.length; i++) {
			   var num = arrall[i];
			   if (countMap[num]) {
			     countMap[num]++;
			   } else {
			     countMap[num] = 1;
			   }
			 }
			 console.log(countMap);
		

			 var sortedCountMap = Object.entries(countMap).sort((a, b) => b[1] - a[1]);
			 var i=0;
			 for (var [num, count] of sortedCountMap) {
			     i++;
			   console.log(num + ": " + count);
			   $("#div2-3").append("<lable>"+num+"("+count+")"+"</lable>");
			   if(i>20){
				   break;
			   }
			 } 
			 $("#div2-3").children().click(function(){
				 var value = $(this).text();
				 value = value.replace(/\d+/g, '');
				 value = value.replace('(','');
				 value = value.replace(')','');
					var list = $("td[name=ztConent]");
					for (var i = 0; i < list.length; i++) {
						var text =$(list[i]).text();
						debugger;
					    if(text.length<=0){
					    	$(list[i]).parent().hide();
					    	continue;
					    }
						if(text.indexOf(value) >=0){
							$(list[i]).parent().show();
						}else{
							$(list[i]).parent().hide();
						} 
						
					}
			 });
			
		});
		
		
		
		
		
 		$("#bt15").click(function(){
			 
			 
			 $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/getStockQQ",
					dataType : 'text',
					 
					success : function(msg) {
						
						//alert(msg);
						$("#myDiv").html(msg);
						$("#mytalbe").addClass("gridtable"); 
						//tongyong();
					}
				});
			 
		 });
		
		 $("#bt9_1").click(function(){
			 
			 
			 $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/getGnStockList",
					dataType : 'text',
					data:{text5:$("#text5").val()},
					success : function(msg) {
						
						//alert(msg);
						$("#myDiv").html(msg);
						$("#mytalbe").addClass("gridtable"); 
						//tongyong();
					}
				});
			 
		 });
		
		 $("#bt13_0").click(function(){
			  
			  $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/execZTcontent1",
					dataType : 'text',
					data:{text6:$("#text6").val(),text7:$("#text7").val()},
					success : function(msg) {
						
						alert(msg);
						//$("#myDiv").html(msg);
						//$("#mytalbe").addClass("gridtable"); 
						//tongyong();
					}
				});
			  
			  
		  });

		  $("#bt13").click(function(){
			  
			  $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/execZTcontent",
					dataType : 'text',
					data:{text6:$("#text6").val(),text7:$("#text7").val()},
					success : function(msg) {
						
						alert(msg);
						//$("#myDiv").html(msg);
						//$("#mytalbe").addClass("gridtable"); 
						//tongyong();
					}
				});
			  
			  
		  });
		$("#bt14").click(function(){
			  
			  $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/getStocCls",
					dataType : 'text',
					data:{text6:$("#text6").val(),text7:$("#text7").val()},
					success : function(msg) {
						
						alert(msg);
						//$("#myDiv").html(msg);
						//$("#mytalbe").addClass("gridtable"); 
						//tongyong();
					}
				});
			  
			  
		  });
		
		
		 $(".close-btn").click(function () {
		      $(".popup").hide();
		    });
		function init(){
			
			var date = new Date();
			var year = date.getFullYear();
			var month = (date.getMonth() + 1).toString().padStart(2, '0');
			var day = date.getDate().toString().padStart(2, '0');
			
			$("#date").val(year+""+month+""+day);
			$("#day6").val(year+""+month+""+day);
			$("#day7").val(year+""+month+""+day);
			$("#text6").val(year+""+month+""+day);
			$("#text6_2").val(year+""+month+""+day);
			$("#qianyitian").val(year+""+month+""+day); 
			$("#text18").val(year+""+month+""+day); 
			$("#jia6").val(">=9");
			$("#jia7").val(">=9");
			
		}
		
		 init();
		 
		 $("#bt11").click(function(){
			 
			 $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/getCTop10",
					dataType : 'text',
					data:{text6:$("#text6").val(),text7:$("#text7").val()},
					success : function(msg) {
						$("#myDiv").html(msg);
						$("#mytalbe").addClass("gridtable"); 
						tongyong();
					}
				});
			 
			 
			 
		 });
		 
		 $("#bt9").click(function(){
			 $('table tr').show(); 
		 });
		 
		 $("#bt12").click(function(){
			 
			 $.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/jisuan26",
					dataType : 'text',
					data:{text6:$("#text6").val(),text6_1:$("#text6_1").val(),text6_2:$("#text6_1").val(),text6_3:$("#text6_3").val()},
					success : function(msg) {
						$("#myDiv").html(msg);
						$("#mytalbe").addClass("gridtable"); 
						tongyong();
					}
				});
			 
			 
		 });
		 
		var arrall = [];
		$("#bt8").click(function(){
			arrall = [];
			$("#div1").html("");
			 $('table td[name=gn]').each(function() {
			    var content = $(this).text();
			    var temp = content.split(",");
			    arrall =$.merge(arrall,temp);
			    
			    var text1 = $("#text5").val().split(",");
			    var flag = true;
			    
			     if(text1.length==1){
			    	 if(content.includes(text1)){
			    		
			    	 }else{
			    		 $(this).parent().hide();
			    	 }
			     } 
			     if(text1.length==2){
			    	 if(content.includes(text1[0]) && content.includes(text1[1]) ){
			    		 
			    	 } else{
			    		 $(this).parent().hide();
			    	 }
			     }
			     if(text1.length==3){
			    	 if(content.includes(text1[0]) && content.includes(text1[1])&& content.includes(text1[2]) ){
			    		 
			    	 }else{
			    		 $(this).parent().hide();
			    	 }
			     } 
			  });  
			 var countMap = {};
			 for (var i = 0; i < arrall.length; i++) {
			   var num = arrall[i];
			   if (countMap[num]) {
			     countMap[num]++;
			   } else {
			     countMap[num] = 1;
			   }
			 }

			 var sortedCountMap = Object.entries(countMap).sort((a, b) => b[1] - a[1]);
			 var i=0;
			 for (var [num, count] of sortedCountMap) {
			     i++;
			   console.log(num + ": " + count);
			   $("#div1").append("<lable>"+num+"("+count+")"+"</lable>");
			   if(i>10){
				   break;
			   }
			 }
		}); 
		 $("#bt6").click(function() {
			$.ajax({
				type : "get",
				url : "${pageContext.request.contextPath}/jisuan25",
				dataType : 'text',
				data:{day6:$("#day6").val(),day7:$("#day7").val(),jia6:$("#jia6").val(),jia7:$("#jia7").val(),flag:0},
				success : function(msg) {
					$("#myDiv").html(msg);
					$("#mytalbe").addClass("gridtable"); 
					tongyong();
				}
			});
		 });
		 $("#bt5").click(function() {
				$.ajax({
					type : "get",
					url : "${pageContext.request.contextPath}/jisuan24",
					dataType : 'json',
					data:{day:$("#day5").val(),chaju1:$("#chaju1").val(),chaju2:$("#chaju2").val()},
					success : function(msg) {
						console.log("后台开始计算。5分钟后有答案");
					}
				});
		 });
		 
		function tongyong(){
			
			 $('#mytalbe tr').dblclick(function () {
	                $(this).remove();
	            });
			
			 $("#mytalbe td[name=cjje]:not(:first)").each(function(){ 
				 var num = parseFloat($(this).text()); 
			        var roundedNum = num.toFixed(2);
			        $(this).text(roundedNum);
			 });
			 $("#mytalbe td[name=xiaying]:not(:first)").each(function(){ 
				 var num = parseFloat($(this).text()); 
			        var roundedNum = num.toFixed(2);
			        $(this).text(roundedNum);
			 });
			 $("#mytalbe td[name=shizhi]:not(:first)").each(function(){
			        var num = parseFloat($(this).text()); 
			        var roundedNum = num.toFixed(2);
			        $(this).text(roundedNum);
			 });
			 $("#mytalbe td[name=ji20min]:not(:first)").each(function(){
			        var num = parseFloat($(this).text()); 
			        var roundedNum = num.toFixed(2);
			        $(this).text(roundedNum);
			 });
			 $("#mytalbe td[name=liangbi]:not(:first)").each(function(){
			        var num = parseFloat($(this).text()); 
			        var roundedNum = num.toFixed(2);
			        $(this).text(roundedNum);
			 });
			 $("#mytalbe td[name=table_id]").each(function(){ 
			        $(this).hide();
			 });
			 $("#mytalbe td[name=lt]").each(function(){ 
			        $(this).hide();
			 });
			 $("#mytalbe td[name=createTime]").each(function(){ 
			        $(this).hide();
			 });
			 $("#mytalbe td[name=cjllist]").each(function(){ 
			        $(this).hide();
			 });
			 $("#mytalbe td[name=qy]").each(function(){ 
			        $(this).hide();
			 });
			 $("#mytalbe td[name=jgbi]:not(:first)").each(function(){ 
				 var num = parseFloat($(this).text()); 
			        var roundedNum = num.toFixed(2);
			        $(this).text(roundedNum);
			 });
			 $("td[name='zhangdiefu']:not(:first)").each(function () {
			        var value = parseFloat($(this).text());
			        if (!isNaN(value)) {
			            if (value >= 0) {
			                $(this).css('color','red');
			            } else {
			                $(this).css('color', 'green');
			            }
			        }
			    });
			 $("#mytalbe td[name=cjlsum]:not(:first)").each(function(){ 
				 var num = parseFloat($(this).text()); 
			        var roundedNum = num.toFixed(2);
			        $(this).text(roundedNum);
			 });
			 $('#mytalbe').each(function() {
				  var rows = $(this).find('tr:not(:first)');
				  rows.sort(function(a, b) {
				    var aValue = $(a).find('td[name=ji20min]').text();
				    var bValue = $(b).find('td[name=ji20min]').text();
				    return aValue.localeCompare(bValue);
				  });
				  $(this).append(rows);
				});
			 
			 $('table tbody tr').sort(function(a, b) {
			        return parseInt($('td[name=cjlsum]', b).text()) - parseInt($('td[name=cjlsum]', a).text());
			    }).appendTo('table tbody');
			 $('table tbody tr').sort(function(a, b) {
			        return parseInt($('td[name=cjje]', b).text()) - parseInt($('td[name=cjje]', a).text());
			  }).appendTo('table tbody');
			 
			 
		}
		 
		 
		
		$("#bt1").click(function() {
			$.ajax({
				type : "get",
				url : "${pageContext.request.contextPath}/jisuan20",
				dataType : 'json',
				data:{day:$("#day").val(),chaju1:$("#chaju1").val(),chaju2:$("#chaju2").val()},
				success : function(msg) {
					console.log("后台开始计算。5分钟后有答案");
				}
			});
		});
		
		$("#bt2").click(function() {
			$.ajax({
				type : "get",
				url : "${pageContext.request.contextPath}/jisuan21",
				dataType : 'json',
				data:{day:$("#day1").val(),chaju3:$("#chaju3").val(),chaju4:$("#chaju4").val()},
				success : function(msg) {
					console.log("后台开始计算。5分钟后有答案");
				}
			});
		});
		$("#bt3").click(function() {
			$.ajax({
				type : "get",
				url : "${pageContext.request.contextPath}/jisuan22",
				dataType : 'json',
				data:{day:$("#day2").val(),chaju5:$("#chaju5").val(),chaju6:$("#chaju6").val(),chaju7:$("#chaju7").val()},
				success : function(msg) {
					console.log("后台开始计算。5分钟后有答案");
				}
			});
		});
		$("#bt4").click(function() {
			$.ajax({
				type : "get",
				url : "${pageContext.request.contextPath}/jisuan23",
				dataType : 'json',
				data:{day3:$("#day3").val(),day4:$("#day4").val(),liang:$("#liang").val(),jia:$("#jia").val()},
				success : function(msg) {
					console.log("后台开始计算。5分钟后有答案");
				}
			});
		});
		$("#bt10").click(function() {
			$.ajax({
				type : "get",
				url : "${pageContext.request.contextPath}/selectsuanfa",
				dataType : 'text',
				data:{suanfa:$("#suanfa").val(),date:$("#date").val()},
				success : function(msg) {
					console.log(msg);
					$("#myDiv").html(msg);
					$("#mytalbe").addClass("gridtable"); 
					 $("#mytalbe td[name=shizhi]:not(:first)").each(function(){
					        var num = parseFloat($(this).text()); 
					        var roundedNum = num.toFixed(2);
					        $(this).text(roundedNum);
					 });
					 $("#mytalbe td[name=ji20min]:not(:first)").each(function(){
					        var num = parseFloat($(this).text()); 
					        var roundedNum = num.toFixed(2);
					        $(this).text(roundedNum);
					 });
					 $("#mytalbe td[name=table_id]").each(function(){ 
					        $(this).hide();
					 });
					 $("#mytalbe td[name=jgbi]:not(:first)").each(function(){ 
						 var num = parseFloat($(this).text()); 
					        var roundedNum = num.toFixed(2);
					        $(this).text(roundedNum);
					 });
					 $('#mytalbe').each(function() {
						  var rows = $(this).find('tr:not(:first)');
						  rows.sort(function(a, b) {
						    var aValue = $(a).find('td[name=ji20min]').text();
						    var bValue = $(b).find('td[name=ji20min]').text();
						    return aValue.localeCompare(bValue);
						  });
						  $(this).append(rows);
						}); 
				}
			});
		});
		
		 
		 
		
		
	})();
</script>

</html>